<%-- 
    Document   : result.jsp
    Created on : 23.10.2012, 3:31:21
    Author     : eleven
--%>

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@page import="calculator.TypeCalculator"%>
<%@page import="java.util.*" %>
<%@page import="calculator.TypeCalculator" %>
<%@page import="result.ResultCalculation" %>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Distance Calculator</title>
    </head> 
    <body>
        <jsp:useBean id="results" scope="session" class="java.util.LinkedList"/>
        <h1>Result Page</h1>
        <%for (Iterator i = results.iterator(); i.hasNext();) {
                ResultCalculation result = (ResultCalculation) i.next();
        %>       
        <table>
            <tr>
                <td>Type Calculation:</td>
                <td><%= result.getType().getId()%></td>
            </tr>
            <tr>
                <td>From City:</td>
                <td><%= result.getFromCity()%></td>
            </tr>
            <tr>
                <td>To City:</td>
                <td><%= result.getToCity()%></td>
            </tr>
            <tr>
                <td>Distance:</td>

                <td>
                    <%if(Double.isNaN(result.getResult())) {%>
                    This is not available for this cities
                    <%}else{%>
                    <%= result.getResult() %>
                    <%}%>
                </td>
            </tr>
        </table> </br>
        <%}%>
    </body>
</html>
